package com.cyh.testdesignpattern.command;

//电视关的命令
public class TvOffCommand implements Command {
    TvReceiver tv;

    public TvOffCommand(TvReceiver tv) {
        this.tv = tv;
    }

    @Override
    public void execute() {
        //调用接收者的方法
        tv.off();
    }

    //撤销
    @Override
    public void undo() {
        tv.on();
    }
}
